home *** CD-ROM | disk | FTP | other *** search
- unit Invoice;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, ExtCtrls, Toolbar
- , UserInfo, Menus;
-
- type
- TInvoiceForm = class(TForm)
- Memo1: TMemo;
- Memo2: TMemo;
- Memo3: TMemo;
- Label1: TLabel;
- MessagePanel2: TMessagePanel;
- Label2: TLabel;
- Label3: TLabel;
- Memo4: TMemo;
- Image1: TImage;
- Memo5: TMemo;
- Button1: TButton;
- Label4: TLabel;
- EdRight1: TEdRight;
- PopupMenu1: TPopupMenu;
- Print1: TMenuItem;
- Close1: TMenuItem;
- procedure Button1Click(Sender: TObject);
- procedure FormActivate(Sender: TObject);
- procedure FormDeactivate(Sender: TObject);
- procedure Memo2Enter(Sender: TObject);
- procedure Memo2Exit(Sender: TObject);
- procedure EdRight1Enter(Sender: TObject);
- procedure EdRight1Exit(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- procedure Close1Click(Sender: TObject);
- procedure Print1Click(Sender: TObject);
- private
- { Private declarations }
- fOnHint: TNotifyevent;
- procedure OnHint(Sender: TObject);
- public
- { Public declarations }
- end;
-
- TInvoice = class(TDialogShell)
- public
- procedure Execute; Override;
- end;
-
- implementation
-
- {$R *.DFM}
-
- const
- InvoiceForm: TInvoiceForm= nil;
-
-
- procedure TInvoiceForm.Close1Click(Sender: TObject);
- begin
- close;
- end;
-
- procedure TInvoiceForm.Print1Click(Sender: TObject);
- begin
- Button1.Click;
- end;
-
- procedure TInvoice.Execute;
- begin
- if InvoiceForm=nil then begin
- InvoiceForm:=TInvoiceForm.Create(Application);
- with InvoiceForm do begin
- OnClose:=FormClose;
- Show;
- end
- end
- else
- InvoiceForm.BringToFront;
- end;
-
-
- procedure TInvoiceForm.FormClose(Sender: TObject;
- var Action: TCloseAction);
- begin
- AcTion:=caFree;
- InvoiceForm:=nil;
- end;
-
-
- procedure TInvoiceForm.Button1Click(Sender: TObject);
- var
- i,n,h,w:integer;
- begin
- Button1.Visible:=False;
- Caption:='Printing '+Caption;
- Enabled:=False;
- h:=Height;
- w:=width;
- Width:=w+200;
- n:=ControlCount-1;
- for i:=0 to n do
- Controls[i].Left:=Controls[i].Left+100;
- Height:=h+450;
- with TMemo.Create(Self) do begin
- Parent:=Self;
- BorderStyle:=bsNone;
- Height:=350;
- Align:=AlBottom;
- Clear;
- with lines do begin
- Add('');
- Add('');
- Add('');
- Add('RETURN ADDRESS');
- Add('');
- Add(Memo2.Text);
- Add('');
- Add('');
- Add('');
- Add('SEND TO');
- Add('');
- Add(Memo1.Text);
- end;
- Print;
- Free;
- end;
- Height:=h;
- for i:=0 to n do
- Controls[i].Left:=Controls[i].Left-100;
- Width:=w;
- Enabled:=True;
- Caption:=Copy(Caption,10,255);
- Button1.Visible:=True;
- end;
-
- procedure TInvoiceForm.FormActivate(Sender: TObject);
- begin
- fOnHint:=Application.OnHint;
- Application.OnHint:=OnHint;
- end;
-
- procedure TInvoiceForm.FormDeactivate(Sender: TObject);
- begin
- Application.OnHint:=fOnHint;
- end;
-
- procedure TInvoiceForm.OnHint(Sender: TObject);
- begin
- with Button1 do
- if Application.Hint='' then
- Caption:='Click to Print the '+Self.Caption
- else
- Caption:=Application.Hint+'; Click to Print';
- end;
-
- procedure TInvoiceForm.Memo2Enter(Sender: TObject);
- begin
- tMemo(Sender).BorderStyle:=bsSingle;
- end;
-
- procedure TInvoiceForm.Memo2Exit(Sender: TObject);
- begin
- tMemo(Sender).BorderStyle:=bsNone;
- end;
-
- procedure TInvoiceForm.EdRight1Enter(Sender: TObject);
- begin
- EdRight1.Font.Style:= EdRight1.Font.Style-[fsUnderline];
- end;
-
- procedure TInvoiceForm.EdRight1Exit(Sender: TObject);
- begin
- EdRight1.Font.Style:= EdRight1.Font.Style+[fsUnderline]
- end;
-
-
- {-----------------------------------------------------------------------------------------}
-
- {
- const
- Initialize: Boolean= True;
-
- initialization
- if Initialize then
- with TInvoice.Create(Application) do try
- dec(Initialize);
- Execute;
- finally
- Free;
- end; {}
- end.
-